//Nguoi viet: chanhlt
//Ngay viet: 18/9/2012

namespace java MiddlewareFrontend
namespace cpp MiddlewareFrontend

struct Tag{   
  1:string tagKey,
  2:string tagName
}

struct Item{   //struct cau nghi nhanh
  1:string itemKey, 
  2:string itemName
//  3:Tag itemTag
}

struct User{
  1:string userID,
  2:i32 userRole
}

service MiddlewareFrontend{

  list<Tag> getAllTag(), //lay danh sach tag
  bool insertTag(1:string tagName),      //them tag
  bool deleteTag(1:string tagKey),       //xoa tag
  bool updateTag(1:string tagKey, 2:string tagName), //sua tag
	  
  list<Item> getAllItem(),    		//lay tat ca cac cau nghi nhanh		
  list<Item> getRandomItems(1:i32 itemNumber), //lay random itemNumber cau nghi nhanh
  bool postOnWall(1:string userID), //post cau nghi nhanh len tuong nha
  
  list<Item> getItemsPage(1:i32 pageNumber, 2:i32 itemNumber), //pageNumber: trang, itemNumber: so records tren 1 trang
  bool insertItem(1:string itemName, 2:string tagKey), //them cau nghi nhanh
  bool deleteItem(1:string itemKey),	//xoa 1 cau nghi nhanh
  bool updateItem(1:string itemKey, 2:string itemName, 3:string tagKey), //sua cau nghi nhanh
  
  list<Item> searchItemTag(1:string tagKey),	//tim kiem cau nghi nhanh theo tag
  list<Item> searchItemKeyword(1:string keyWord),//tim kiem cau nghi nhanh theo keyword
  Item backLastSelect(1:string userName),	//back lai cau nghi nhanh da chon truoc do
  list<Tag> getBestTags(),	//lay danh sach cac tag noi bat
  list<Item> getBestItems(),	//lay danh sach cau cau noi bat
  bool saveFavoriteItem(1:string itemKey, 2:string userName) //luu lai cau nghi nhanh yeu thich
  
  bool blockUser(1: string userID), //khoa khong cho userID truy cap ung dung
  bool unBlockUser(1: string userID), //mo khoa cho userID truy cap ung dung
  
}
